package com.cph.project.service.impl;

import java.util.List;
import java.util.UUID;

import com.cph.common.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cph.project.mapper.OaProjectOpportunityPortraitMapper;
import com.cph.project.pojo.OaProjectOpportunityPortrait;
import com.cph.project.service.IOaProjectOpportunityPortraitService;

/**
 * 项目机会画像Service业务层处理
 * 
 * @author cph
 * @date 2020-02-26
 */
@Service
public class OaProjectOpportunityPortraitServiceImpl implements IOaProjectOpportunityPortraitService 
{
    @Autowired
    private OaProjectOpportunityPortraitMapper oaProjectOpportunityPortraitMapper;

    /**
     * 查询项目机会画像
     * 
     * @param id 项目机会画像ID
     * @return 项目机会画像
     */
    @Override
    public OaProjectOpportunityPortrait selectOaProjectOpportunityPortraitById(String id)
    {
        return oaProjectOpportunityPortraitMapper.selectOaProjectOpportunityPortraitById(id);
    }

    /**
     * 查询项目机会画像列表
     * 
     * @param oaProjectOpportunityPortrait 项目机会画像
     * @return 项目机会画像
     */
    @Override
    public List<OaProjectOpportunityPortrait> selectOaProjectOpportunityPortraitList(OaProjectOpportunityPortrait oaProjectOpportunityPortrait)
    {
        return oaProjectOpportunityPortraitMapper.selectOaProjectOpportunityPortraitList(oaProjectOpportunityPortrait);
    }

    /**
     * 新增项目机会画像
     * 
     * @param oaProjectOpportunityPortrait 项目机会画像
     * @return 结果
     */
    @Override
    public int insertOaProjectOpportunityPortrait(OaProjectOpportunityPortrait oaProjectOpportunityPortrait)
    {
        oaProjectOpportunityPortrait.setId(UUID.randomUUID().toString());
        oaProjectOpportunityPortrait.setCreateTime(DateUtils.getNowDate());
        return oaProjectOpportunityPortraitMapper.insertOaProjectOpportunityPortrait(oaProjectOpportunityPortrait);
    }

    /**
     * 修改项目机会画像
     * 
     * @param oaProjectOpportunityPortrait 项目机会画像
     * @return 结果
     */
    @Override
    public int updateOaProjectOpportunityPortrait(OaProjectOpportunityPortrait oaProjectOpportunityPortrait)
    {
        oaProjectOpportunityPortrait.setUpdateTime(DateUtils.getNowDate());
        return oaProjectOpportunityPortraitMapper.updateOaProjectOpportunityPortrait(oaProjectOpportunityPortrait);
    }

    /**
     * 批量删除项目机会画像
     * 
     * @param ids 需要删除的项目机会画像ID
     * @return 结果
     */
    @Override
    public int deleteOaProjectOpportunityPortraitByIds(String[] ids)
    {
        return oaProjectOpportunityPortraitMapper.deleteOaProjectOpportunityPortraitByIds(ids);
    }

    /**
     * 删除项目机会画像信息
     * 
     * @param id 项目机会画像ID
     * @return 结果
     */
    @Override
    public int deleteOaProjectOpportunityPortraitById(String id)
    {
        return oaProjectOpportunityPortraitMapper.deleteOaProjectOpportunityPortraitById(id);
    }
}
